const msg = require('fs')
    .readFileSync('.git/COMMIT_EDITMSG','utf-8')
        .trim()
const commitReg = /^(revert: )?(feat|fix|release|docs)(\(.+\))?: .{1,50}/
const mergeReg = /^(Merge pull request|Merge branch)/
if(!commitReg.test(msg)){
    if(!mergeReg.test(msg)){
        console.log('git commit 不合规范！')
        console.error('git commit unaccessable, read scripts/checkCommit.js for more information please.');
        process.exit(1)
    }
}else{
    console.log('git commit check pass.')
}